<!DOCTYPE html>
<html>
<head>
    <title>商品管理sys</title>
    <#include "/header.html">
        </head>
<body>
<div id="rrapp" v-cloak>
    <div v-show="showList">
        <div class="grid-btn">

            <a class="btn btn-primary" @click="query"><i class="fa fa-plus"></i>&nbsp;查询</a>

            <#if shiro.hasPermission("demo:goods:save")>
                <a class="btn btn-primary" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</a>
            </#if>
            <#if shiro.hasPermission("demo:goods:update")>
                <a class="btn btn-primary" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</a>
            </#if>
            <#if shiro.hasPermission("demo:goods:delete")>
                <a class="btn btn-primary" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</a>
            </#if>
            <label for="upload" class="btn btn-primary"><i class="fa fa-plus"></i>&nbsp;导入</label>
            <input type="file" id="upload" name="upload" style="display:none" v-on:change="exportExcel"
                   accept=".xls,.xlsx"/>
            <a href="${request.contextPath}/statics/download/goods.xlsx">模板下载</a>
        </div>

        <div class="screen-box screen-right-fourbox m-t-sm" style="height: 300px;width: 100%;">
            <div class="screen" id="myChart" style="height: 100%;width: 100%;"></div>
        </div>

        <table id="jqGrid"></table>
        <div id="jqGridPager"></div>
    </div>

    <!-- 模态框（Modal） -->
    <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                        &times;
                    </button>
                    <h4 class="modal-title" id="myModalLabel">
                        {{title}}
                    </h4>
                </div>
                <div class="modal-body">
                    <form class="form-horizontal">
                        <div class="form-group">
                            <div class="col-sm-2 control-label">商品名</div>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" v-model="goods.name" placeholder="商品名"/>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-sm-2 control-label">介绍</div>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" v-model="goods.intro" placeholder="介绍"/>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-sm-2 control-label">价格</div>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" v-model="goods.price" placeholder="价格"/>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-sm-2 control-label">数量</div>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" v-model="goods.num" placeholder="数量"/>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="modal-footer">
                    <input type="button" class="btn btn-primary" @click="saveOrUpdate" value="确定"/>
                    <button type="button" class="btn btn-warning" data-dismiss="modal">关闭</button>
                </div>
            </div><!-- /.modal-content -->
        </div><!-- /.modal -->
    </div>

    <div v-show="!showList" class="panel panel-default">
        <div class="panel-heading">{{title}}</div>
        <form class="form-horizontal">
            <div class="form-group">
                <div class="col-sm-2 control-label">商品名</div>
                <div class="col-sm-10">
                    <input type="text" class="form-control" v-model="goods.name" placeholder="商品名"/>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">介绍</div>
                <div class="col-sm-10">
                    <input type="text" class="form-control" v-model="goods.intro" placeholder="介绍"/>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">价格</div>
                <div class="col-sm-10">
                    <input type="text" class="form-control" v-model="goods.price" placeholder="价格"/>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">数量</div>
                <div class="col-sm-10">
                    <input type="text" class="form-control" v-model="goods.num" placeholder="数量"/>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label"></div>
                <input type="button" class="btn btn-primary" @click="saveOrUpdate" value="确定"/>
                &nbsp;&nbsp;<input type="button" class="btn btn-warning" @click="reload" value="返回"/>
            </div>
        </form>
    </div>
</div>
<script src="${request.contextPath}/statics/plugins/echart/echarts.js"></script>
<script src="${request.contextPath}/statics/js/modules/demo/goods.js?_${.now?long}"></script>
<script type="text/javascript">
    echartData();
</script>
</body>
</html>